import {
	ajax
} from "@/utils/ajax.js"

export const genres = {
	dynamic: 1, 
	comment: 3, 
}

export const praise = async ({
	id,
	genre,
	type
}) => {
	if (praise.lock) {
		throw new Error('正在请求中')
	}
	try {
		praise.lock = true;
		const res = await ajax({
			url: '/praiseLog/add',
			data: {
				businessId: id,
				businessType: genre,
				operationType: type
			}
		})
		return res;
	}finally {
		praise.lock = false;
	}
}


export const getPraiseList = ({id,genre,pageNo=1,pageSize=10})=>{
	return ajax({
		url: '/praiseLog/simpleList',
		data: {
			businessId: id,
			businessType: genre,
			pageNo,
			pageSize
		}
	})
}